package com.sikaryofficial.workbench.domain.eo;

import lombok.Data;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
public class PriceTierEO {
    /**
     * 最小数量
     */
    private Integer minQuantity;
    /**
     * 最大数量
     */
    private Integer maxQuantity;
    /**
     * 单价
     */
    @NotNull(message = "阶梯价单价不能为空")
    private BigDecimal unitPrice;

    @AssertTrue(message = "阶梯价最小值最大值不能同时为空")
    public Boolean getValid() {
        return minQuantity != null || maxQuantity != null;
    }
}
